package com.practice.httputils.fegin;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description : 工厂模式+策略模式
 * @Version : V1.0.0
 * @Date : 2023/1/10 17:11
 */
@Component
public class DynamicClient {

    @Autowired
    private DynamicFeignClientFactory dynamicFeignClientFactory;

    public Object executePostApi(String feignName, String url, Object params) {
        final DynamicService feignClient = dynamicFeignClientFactory.getFeignClient(DynamicService.class, feignName);
        return feignClient.executePostApi(url, params);
    }

    public Object executeGetApi(String feignName, String url, Object params) {
        final DynamicService feignClient = dynamicFeignClientFactory.getFeignClient(DynamicService.class, feignName);
        return feignClient.executeGetApi(url, params);
    }
}
